public class t322 {//零钱兑换

    public static void main(String[] args) {
        int arr[] = {1,2,5};
        int num = 11;
        int n = arr.length;
        int dp [] = new int [num+1];
        dp[0] =0;
        for(int i =1;i<=num;i++){
            dp[i] = Integer.MAX_VALUE;
            for(int j = 0;j<n;j++){
                if(i-arr[j]>=0 && dp[i-arr[j]]!=Integer.MAX_VALUE){
                        dp[i] = Math.min(dp[i],dp[i-arr[j]]+1);
                }
            }
        }
        if(dp[num] == Integer.MAX_VALUE){
            System.out.println(-1);
            //return -1;
        }else{
            System.out.println(dp[num]);
            //return dp[num];
        }
    }
}
